home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / mechacatdestructo.swf / scripts / frame_7 / PlaceObject2_320_1171 / CLIPACTIONRECORD onClipEvent(load).as
Text File  |  2007-10-01  |  4KB  |  168 lines

  1. onClipEvent(load){
  2.    function getScores()
  3.    {
  4.       if(G_TestHighScore == true)
  5.       {
  6.          trace("getScores");
  7.       }
  8.       if(gProxyObj == undefined)
  9.       {
  10.          if(G_TestHighScore == true)
  11.          {
  12.             trace("dans getscore, listescore");
  13.          }
  14.          listScores();
  15.       }
  16.       else
  17.       {
  18.          if(G_TestHighScore == true)
  19.          {
  20.             trace("dans getscore, getScores");
  21.          }
  22.          gProxyObj.getScores(cbFunc2);
  23.       }
  24.    }
  25.    function submitScore(theScore)
  26.    {
  27.       if(G_TestHighScore == true)
  28.       {
  29.          trace("Envoie le score = " + theScore);
  30.       }
  31.       gProxyObj.submitScore(theScore,cbFunc);
  32.    }
  33.    function initHiScores()
  34.    {
  35.       if(G_TestHighScore == true)
  36.       {
  37.          trace("Tu init le highscore!");
  38.       }
  39.       gProxyObj.setGame_Id("cs_destructo");
  40.    }
  41.    function getScoreString()
  42.    {
  43.       var _loc5_ = "Oops! The high score list isn\'t available right now!";
  44.       var _loc8_ = 30;
  45.       if(gProxyObj != undefined)
  46.       {
  47.          var _loc7_ = gProxyObj.getScoreCount();
  48.          if(_loc7_ > 0)
  49.          {
  50.             var _loc1_ = undefined;
  51.             var _loc6_ = undefined;
  52.             var _loc3_ = undefined;
  53.             var _loc4_ = undefined;
  54.             _loc5_ = "";
  55.             _loc1_ = 0;
  56.             while(_loc1_ < _loc7_)
  57.             {
  58.                _loc6_ = gProxyObj.getScoreItem(_loc1_);
  59.                _loc3_ = _loc6_[0];
  60.                _loc4_ = fStyleNumber(_loc6_[1]);
  61.                spaceNb = _loc8_ - _loc3_.length - _loc4_.length - 4;
  62.                spaceTXT = "";
  63.                var _loc2_ = 0;
  64.                while(_loc2_ < spaceNb)
  65.                {
  66.                   spaceTXT += " ";
  67.                   _loc2_ = _loc2_ + 1;
  68.                }
  69.                if(_loc1_ < 9)
  70.                {
  71.                   _loc5_ += _loc1_ + 1 + "   " + _loc3_ + spaceTXT + _loc4_ + "\n";
  72.                }
  73.                else if(_loc1_ < 99)
  74.                {
  75.                   _loc5_ += _loc1_ + 1 + "  " + _loc3_ + spaceTXT + _loc4_ + "\n";
  76.                }
  77.                else
  78.                {
  79.                   _loc5_ += _loc1_ + 1 + " " + _loc3_ + spaceTXT + _loc4_ + "\n";
  80.                }
  81.                _loc1_ = _loc1_ + 1;
  82.             }
  83.          }
  84.          else
  85.          {
  86.             _loc5_ = "Whoops, the high scores seem to have escaped!";
  87.          }
  88.       }
  89.       if(G_TestHighScore == true)
  90.       {
  91.          trace("Tu retournes ├ºa = " + _loc5_);
  92.       }
  93.       return _loc5_;
  94.    }
  95.    function listScores()
  96.    {
  97.       if(G_TestHighScore == true)
  98.       {
  99.          trace("Liste les scores..");
  100.       }
  101.       _parent.txt_highScore.text = getScoreString();
  102.    }
  103.    function cbFunc(thisBool)
  104.    {
  105.       if(thisBool)
  106.       {
  107.          listScores();
  108.       }
  109.       else
  110.       {
  111.          if(G_TestHighScore == true)
  112.          {
  113.             trace("CBfunc y├⌐ false...");
  114.          }
  115.          _parent.txt_highScore.text = "Oops! The high score list isnΓÇÖt available right now!";
  116.       }
  117.    }
  118.    function cbFunc2(thisBool)
  119.    {
  120.       if(thisBool)
  121.       {
  122.          listScores();
  123.       }
  124.       else
  125.       {
  126.          _parent.txt_highScore.text = "Oops! The high score list isnΓÇÖt available right now!";
  127.       }
  128.    }
  129.    function fStyleNumber(_nNumber, _nMinimumChar)
  130.    {
  131.       _sNumber = String(_nNumber);
  132.       _sNewString = "";
  133.       _nlength = _sNumber.length;
  134.       _nlength /= 3;
  135.       if(_nlength <= 1)
  136.       {
  137.          _sNewNumber = _sNumber;
  138.          if(_sNewNumber.length < _nMinimumChar)
  139.          {
  140.             _sNewNumber = "0" + _sNewNumber;
  141.          }
  142.          return _sNewNumber;
  143.       }
  144.       _nLoop = _nlength;
  145.       while(_nLoop > 1)
  146.       {
  147.          _sNewString = " " + _sNumber.substr(-3) + _sNewString;
  148.          _sNumber = _sNumber.substr(0,-3);
  149.          _nLoop--;
  150.       }
  151.       _sNewNumber = _sNumber + _sNewString;
  152.       if(_sNewNumber.length < _nMinimumChar)
  153.       {
  154.          _sNewNumber = "0" + _sNewNumber;
  155.       }
  156.       return _sNewNumber;
  157.    }
  158.    _global.HS = this;
  159.    var G_ShowHighScore = true;
  160.    var G_TestHighScore = false;
  161.    if(G_TestHighScore == true)
  162.    {
  163.       gProxyObj.setServer("www.nick-q.mtvi.com");
  164.       gProxyObj.setScreenName("DanQuiTest");
  165.       gProxyObj.setIsLoggedIn(true);
  166.    }
  167. }
  168.